<template>
  <div class="optionBox">
    <div class="typeBox">{{tagname}}</div>
    <div class="selecttype">
            <div
        :class="type == null ? 'tag tagall cursor' : 'tag cursor'"
        @click="tagFn(-2)"
      >
        All
      </div>
      <div
        :class="item.id == type ? 'tag tagall cursor' : 'tag cursor'"
        @click="tagFn(item.id)"
        v-for="(item, index) in tagArr"
        :key="index"
      >
        {{ item.name }}
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["tagArr",'tagname','type'],
  data() {
    return {
    };
  },
  methods: {
    tagFn(index) {
      console.log(index);
      this.$emit('tagFn',index)
    },
  }
};
</script>
 
<style lang = "less" scoped>
.optionBox {
      display: flex;
      margin-bottom: 10px;
      .typeBox {
        padding: 1px 0 0 10px;
        box-sizing: border-box;
        width: 130px;
        font-size: 14px;
        line-height: 14px;
        color: #999999;
        /* margin-right: 30px; */
      }
      .selecttype {
        width: 1030px;
        display: flex;
        flex-wrap: wrap;
        .tag {
          /* padding: 6px 23px; */
          font-size: 14px;
          line-height: 18px;
          color: #333333;
          margin-right: 42px;
          margin-bottom: 13px;
        }
        .tagall {
          /* background-color: #fb6e3b; */
          color: #fb6e3b;
        }
      }
    }
</style>